<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      姓<input type="text" v-model="firstName" /> 名<input
        type="text"
        v-model="lastName"
      />
      <p>{{nullName}}</p>
    </div>
    <script src="./js/vue.js"></script>
    <script>
      const vm = new Vue({
        data:{
          lastName:"",
          firstName:"",
          nullName:"",
        },

        watch: {
          firstName(firstName) {
            this.nullName = firstName + "" + this.lastName;
          },
          lastName(lastName) {
            this.nullName = this.firstName + "" + lastName;
          },
        },
      });
      vm.$mount("#app");
    </script>
  </body>
</html>
